project('gtk-demo', 'c')

gtk_dep = dependency('gtk4')
pango_dep = dependency('pango')
freetype2_dep = dependency('freetype2')
pangoft2_dep = dependency('pangoft2')
json_dep = dependency('json-glib-1.0')
epoxy_dep = dependency('epoxy')

gnome = import('gnome')
resources = gnome.compile_resources('resources', 'src/index.gresource.xml')

base_dep = declare_dependency(
    dependencies: [gtk_dep, pango_dep, freetype2_dep, pangoft2_dep, json_dep, epoxy_dep],
)

object_sources = files(
    'src/objects/object_session_data.c',
)
object_lib = static_library(
    'object',
    object_sources,
    dependencies: [base_dep],
)
object_dep = declare_dependency(
    include_directories: include_directories('src/objects'),
    link_with: object_lib,
)

common_sources = files(
    'src/common/utils.c',
)
common_lib = static_library(
    'common',
    common_sources,
    dependencies: [base_dep],
)
common_dep = declare_dependency(
    include_directories: include_directories('src/common'),
    link_with: common_lib,
)

component_sources = files(
    'src/components/component_font_awesome.c',
    'src/components/component_image.c',
    'src/components/component_right_top_button_group.c',
    'src/components/component_session.c',
)
component_lib = static_library(
    'component',
    component_sources,
    dependencies: [base_dep, object_dep, common_dep],
)
component_dep = declare_dependency(
    include_directories: include_directories('src/components'),
    link_with: component_lib,
)

window_sources = files(
    'src/windows/window_index.c',
    'src/windows/window_test.c',
)
window_lib = shared_library(
    'window',
    window_sources,
    dependencies: [base_dep, component_dep],
)
window_dep = declare_dependency(
    include_directories: include_directories('src/windows'),
    link_with: window_lib,
)

sourcefiles = files(
    'src/main.c',
)

executable(
    'gtk-demo',
    sourcefiles,
    resources,
    dependencies: [base_dep, window_dep],
)